home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / sviluppo / svilupp2 / whdload.lha / WHDLoad / src / oscar.asm < prev    next >
Assembly Source File  |  1996-07-03  |  3KB  |  167 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Program.    oscar.asm
  3. ;  :Contents.    Slave for "Oscar"
  4. ;  :Author.    BJ
  5. ;  :History.    20.05.96
  6. ;  :Requires.    -
  7. ;  :Copyright.    Public Domain
  8. ;  :Language.    68000 Assembler
  9. ;  :Translator.    Barfly V1.131
  10. ;  :To Do.
  11. ;---------------------------------------------------------------------------*
  12.  
  13.     INCDIR    Includes:
  14.     INCLUDE    whdload.i
  15.  
  16.     OUTPUT    wart:oscar/oscar.slave
  17.     BOPT    O+ OG+            ;enable optimizing
  18.     BOPT    w4-            ;disable 64k warnings
  19.  
  20. ;======================================================================
  21.  
  22. .base        SLAVE_HEADER        ;ws_Security + ws_ID
  23.         dc.w    1        ;ws_Version
  24.         dc.w    0        ;ws_flags
  25. .upchip        dc.l    $177000        ;ws_BaseMemSize
  26.         dc.l    $300        ;ws_ExecInstall
  27.         dc.w    .Start-.base    ;ws_GameLoader
  28.         dc.w    .dir-.base    ;ws_CurrentDir
  29.         dc.w    0        ;ws_DontCache
  30.  
  31. .dir        dc.b    "data",0,0
  32.  
  33. ;======================================================================
  34. .Start        ;    A0 = resident loader
  35. ;======================================================================
  36.  
  37.         lea    (_resload,pc),a1
  38.         move.l    a0,(a1)            ;save for later using
  39.  
  40.         move.l    #CACRF_EnableI,d0    ;enable instruction cache
  41.         move.l    d0,d1            ;mask
  42.         jsr    (resload_SetCACR,a0)
  43.  
  44.         lea    _10,a0
  45.         move.l    .freemem,a1
  46.         bsr    _Load
  47.         lea    .freemem,a0
  48.         add.l    d0,(a0)
  49.  
  50.         patch    $400+$8b4e,.allocmem    ;emulate this
  51.         nops    ($2a8-$276)/2,$400+$276    ;disable some os-stuff
  52.         patch    $400+$7b1a,_loader
  53.     IFD wmode
  54.         add.l    #$99fc+$400-$9b64,$838+$400
  55.     ENDC
  56.         jmp    $43e            ;start the dance
  57.  
  58. .allocmem    lea    .freemem,a0        ;this emulates "exec.AllocMem"
  59.         move.l    (a0),a1
  60.         add.l    d0,(a0)
  61.         move.l    (a0),d1
  62.         cmp.l    (.upchip),d1
  63.         blo    .1
  64.     illegal                    ;if basemem must increased
  65. .1        move.l    a1,a0
  66.         addq.l    #7,d0
  67.         lsr.l    #3,d0
  68. .clr        clr.l    (a0)+
  69.         clr.l    (a0)+
  70.         subq.l    #1,d0
  71.         bne    .clr
  72.         move.l    a1,d0
  73.         rts
  74.  
  75. .freemem    dc.l    $400            ;start point of free memory
  76.  
  77. _10        dc.b    "exe",0
  78.     EVEN
  79.  
  80. ;--------------------------------
  81.  
  82. _loader
  83.         addq.l    #4,a0            ;skip "df0:"
  84.         bsr    _Load
  85.  
  86.         bsr    _kinit
  87.  
  88.         moveq    #0,d0            ;return code
  89.         rts
  90.  
  91. ;--------------------------------
  92.  
  93. _kinit        movem.l    a0-a1,-(a7)
  94.         lea    (_keyboard,pc),a1
  95.         cmp.l    $68,a1
  96.         beq    .q
  97.         lea    (_realint68,pc),a0
  98.         move.l    $68,(a0)
  99.         move.l    a1,$68
  100. .q        movem.l    (a7)+,a0-a1
  101.         rts
  102.  
  103. _realint68    dc.l    0
  104.  
  105. _keyboard    move.l    d0,-(a7)
  106.         move.b    $bfec01,d0
  107.         ror.b    #1,d0
  108.         not.b    d0
  109.  
  110. ; RAW-Key-Codes:
  111. ;    ESC    $45
  112. ;    DEL    $46
  113. ;    F1..F10    $50..$59
  114. ;    HELP    $5f
  115.  
  116.         cmp.b    #$58,d0
  117.         bne    .1
  118.         move.l    (a7)+,d0
  119.         bra    _debug            ;coredump & quit
  120. .1
  121.         cmp.b    #$59,d0
  122.         beq    _exit            ;exit
  123.         cmp.b    #$45,d0
  124.         beq    _exit            ;exit
  125.  
  126.         move.l    (a7)+,d0
  127.         move.l    (_realint68),-(a7)    ;enter orginal rou.
  128.         rts
  129.  
  130. ;--------------------------------
  131.  
  132. _resload    dc.l    0            ;address of resident loader
  133.  
  134. ;--------------------------------
  135. ; IN:    a0=name a1=loc
  136. ; OUT:    d0=size
  137.  
  138. _Load        movem.l    d1/a0-a2,-(a7)
  139.         move.l    (_resload),a2
  140.         jsr    (resload_LoadFileDecrunch,a2)
  141.         tst.l    d0
  142.         beq    .err
  143.         movem.l    (a7)+,d1/a0-a2
  144.         rts
  145. .err        move.l    d1,d0
  146.         movem.l    (a7)+,d1/a0-a2
  147.         move.l    a0,-(a7)        ;file name
  148.         move.l    d0,-(a7)        ;doserror
  149.         move.l    #TDREASON_DOSREAD,-(a7)
  150.         move.l    (_resload),-(a7)
  151.         add.l    #resload_Abort,(a7)
  152.         rts
  153.  
  154. ;--------------------------------
  155. ;stop the dance
  156.  
  157. _exit        move.l    #TDREASON_OK,-(a7)
  158.         bra    _end
  159. _debug        move.l    #TDREASON_DEBUG,-(a7)
  160. _end        move.l    (_resload,pc),-(a7)
  161.         add.l    #resload_Abort,(a7)
  162.         rts
  163.  
  164. ;======================================================================
  165.  
  166.     END
  167.